
package com.winter.service;

import com.winter.config.BaffleAnAspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 
    挡板处理类
 */
public class BaffleAnService {

    public static Object handler(ProceedingJoinPoint point) throws Throwable {
        Object obj=null;
//        Map<String,Object> map= BaffleAnAspect.getFieldsNameValueMap(point);

        MethodSignature methodSignature = (MethodSignature) point.getSignature();
        String[] parameterNames = methodSignature.getParameterNames();
        if(parameterNames.length == 0) {
            obj=point.proceed();
            return obj;
        }
        if(Arrays.stream(parameterNames).anyMatch(s -> s.equals("id"))) {
            //挡板业务处理
            return "哈哈哈哈";
        }
        obj=point.proceed();
        return obj;
        
    }
}